package main

import (
	"fmt"
	"time"

	"github.com/garyburd/redigo/redis"
)

var pool *redis.Pool

//这里不希望定死  而是通过参数传入
func initPool(address, passwd string, maxIdle, maxActive int, idleTimeout time.Duration) {
	pool = &redis.Pool{
		MaxIdle:     maxIdle,
		MaxActive:   maxActive,
		IdleTimeout: idleTimeout,
		Dial: func() (redis.Conn, error) {
			conn, err := redis.Dial("tcp", address, redis.DialPassword(passwd))
			if err != nil {
				fmt.Println("redispool init error")
				panic()
			}
		},
	}
}
